#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    FILE *fp = NULL;
    int ret;

    if(NULL == (fp = fopen(argv[1], "r"))){
        perror("fopen error");
        exit(-1);
    }

     printf("open file \"%s\" success!\n", argv[1]);

     if(0 > fseek(fp, 0, SEEK_END)){
         perror("fseek error");
         fclose(fp);
         exit(-1);
     }

     if(0 > (ret = ftell(fp))){
         perror("ftell error");
         fclose(fp);
         exit(-1);
     }

     printf("file size: %d\n", ret);

     fclose(fp);
     exit(0);
}
